package com.wfl.sampling.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.time.LocalDateTime;

/**
 * @ Author     ：gfj
 * @ Date       ：Created in 15:14 2023/10/18
 * @ Description：User 实体类
 * @ Modified By：
 * @author gefangjie
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User implements Serializable {
    /**
     * 与数据库一一对应
     * 驼峰命名方法
     * 以包装类型 才好做非空校验
     */
//    public static final User EMPTY = new User(
//            10086,
//            "EMPTY",
//            "EMPTY",
//            "EMPTY",
//            "EMPTY",
//            "EMPTY",
//            "EMPTY",
//            "EMPTY",
//            true,
//            LocalDateTime.now()
//    );

    private int id;
    private String email;
    private String phone;
    private String password;
    private String username;
    private String avatar;
    private String birthDate;
    private String gender;
    private String openId;
    private String token;
    private String sessionId;
    //是否互关
    private boolean isFollow;
    private LocalDateTime lastLoginTime;
    public void from(WxUserInfo wxUserInfo){
        this.username = wxUserInfo.getNickName();
        this.avatar = wxUserInfo.getAvatarUrl();
        this.gender = wxUserInfo.getGender();
        this.openId = wxUserInfo.getOpenId();
//        this.lastLoginTime = LocalDateTime.now();/
    }

}


